#include    "openup_anim.h"


extern uint8_t yuyan_flag;    //默认英文
lv_obj_t*label_open_anim;
LV_FONT_DECLARE(siyuanrouti_20);
lv_obj_t * arc;

static void set_angle(void * var, int32_t v)
{
    lv_arc_set_value((lv_obj_t *)var, v);
}


void Open_up_animation(void){

     /*Create an Arc*/
    arc = lv_arc_create(lv_scr_act());
    lv_arc_set_rotation(arc, 270);
    lv_arc_set_bg_angles(arc, 0, 360);
    lv_obj_set_size(arc,240,240);
    lv_obj_remove_style(arc, NULL, LV_PART_KNOB);   /*Be sure the knob is not displayed*/
    lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);  /*To not allow adjusting by click*/
 	lv_obj_set_style_arc_width(arc,20,LV_PART_INDICATOR);
	lv_obj_set_style_arc_width(arc,20,LV_PART_MAIN);
	lv_obj_set_style_bg_opa(arc,100,NULL);
	lv_obj_set_style_bg_color(arc,lv_color_hex(0x000000),NULL );
    lv_obj_set_style_arc_color(arc,lv_color_hex(0xFFFFFF),LV_PART_INDICATOR);
    lv_obj_set_style_arc_color(arc,lv_color_hex(0x000000),LV_PART_MAIN );  
    lv_obj_center(arc);

    lv_anim_t a;
    lv_anim_init(&a);
    lv_anim_set_var(&a, arc);
    lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)set_angle);
    lv_anim_set_time(&a,3000);
    lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);    /*Just for the demo*/
    lv_anim_set_repeat_delay(&a, 200);
    lv_anim_set_values(&a, 0, 100);
    lv_anim_start(&a);

    label_open_anim=lv_label_create(arc);
    lv_obj_center(label_open_anim);
    lv_obj_set_style_text_font(label_open_anim,&siyuanrouti_20,NULL);
    lv_obj_set_style_text_color(label_open_anim,lv_color_hex(0xF0F0F0),NULL);
    if(yuyan_flag){
    lv_label_set_text(label_open_anim,"Loading...");
    }
    else
    lv_label_set_text(label_open_anim,"载入中...");
}